AddCSLuaFile( "cl_init.lua" ) //dl that
AddCSLuaFile( "shared.lua" ) //dl that too
AddCSLuaFile( "specialchars.lua" ) //and this
AddCSLuaFile( "cl_adminmenu.lua" )
AddCSLuaFile( "cl_load.lua" )
AddCSLuaFile( "adminmenu.lua" )
AddCSLuaFile( "cl_hud.lua" )
AddCSLuaFile( "propprotection.lua" )
AddCSLuaFile( "cl_scoreboard.lua" )
 
 
include( 'shared.lua' ) //load that
include( 'specialchars.lua' ) //This too.
include( 'adminmenu.lua' )
include( 'propprotection.lua' )
require( "datastream" )
 
function GM:PlayerSpawn( ply )  //What happens when the player spawns
 
    self.BaseClass:PlayerSpawn( ply )   // Lines 12 through 18 are all fixes to the sandbox glitch. Don't change
										// them unless you know what you're doing.
    ply:SetGravity( 0.75 )  
    ply:SetMaxHealth( 100, true )  
 
    ply:SetWalkSpeed( 325 )  
	ply:SetRunSpeed( 325 )	
end

function printAction( mssg )
	for k,ply in pairs(player.GetAll()) do
		ply:ChatPrint( mssg )
	end
end

local Interval = 0
function IntervalPrint()
    if (CurTime() >= Interval) then
		for k,ply in pairs(player.GetAll()) do
			ply:ChatPrint("LOL")
		end
        Interval = CurTime() + 300
    end
end
hook.Add("Think", "IntervalPrint", IntervalPrint)


function GM:PlayerInitialSpawn( ply )  // When spawning after joining the sever
	if ply:IsUserGroup("superadmin") then
		ply:SetTeam(4)
		ply:Spawn()
	elseif ply:IsAdmin() then
		ply:SetTeam(3)
		ply:Spawn()
	elseif string.Left(ply:Nick(), 3) == "M |" then
		ply:SetTeam(2)
		ply:Spawn()
	else
		ply:SetTeam(1)
		ply:Spawn()
	end
end

function fPlayerDisconnect( ply )
 
for k,v in pairs( player.GetAll() ) do // Retrieve all the players.
	v:PrintMessage( HUD_PRINTTALK, ply:GetName() .. " has left the server." ) // Tells all players that the certain player has disconnected Ex: FatBoBo Has left the server
 
	end // End the "for"
end // End the function

 
 
function GM:PlayerLoadout( ply )
 
	if ply:Team() == 1 then
	
			ply:PrintMessage( HUD_PRINTTALK, "[Matte\'s Mod]Welcome to the server, " .. ply:Nick() )
			ply:Give( "weapon_physcannon" )
			ply:Give( "weapon_physgun" )
			ply:Give( "gmod_tool" )
			ply:Give( "gmod_camera" )
	 
 
	elseif ply:Team() == 2 then
 
			ply:PrintMessage( HUD_PRINTTALK, "[Matte\'s Mod]Welcome back to the server, " .. ply:Nick() )
			ply:Give( "weapon_physcannon" )
			ply:Give( "weapon_physgun" )
			ply:Give( "gmod_tool" )
			ply:Give( "gmod_camera" )
	
	elseif ply:Team() == 3 then
	
			ply:PrintMessage( HUD_PRINTTALK, "Welcome back, " .. ply:Nick() .. "\nYou connected under the IP: " .. ply:IPAddress() )
			ply:Give( "weapon_physcannon" )
			ply:Give( "weapon_physgun" )
			ply:Give( "weapon_ar2" )
			ply:Give( "gmod_tool" )
			ply:Give( "gmod_camera" )
	
	
	elseif ply:Team() == 4 then
	
			ply:PrintMessage( HUD_PRINTTALK, "Welcome back, " .. ply:Nick() .. "\nYou connected under the IP: " .. ply:IPAddress() )
			ply:Give( "weapon_crowbar" )
			ply:Give( "weapon_pistol" )
			ply:Give( "weapon_smg1" )
			ply:Give( "weapon_frag" )
			ply:Give( "weapon_physcannon" )
			ply:Give( "weapon_crossbow" )
			ply:Give( "weapon_shotgun" )
			ply:Give( "weapon_357" )
			ply:Give( "weapon_rpg" )
			ply:Give( "weapon_ar2" )
			ply:Give( "gmod_tool" )
			ply:Give( "gmod_camera" )
			ply:Give( "weapon_physgun" )
	end
end
 

hook.Add( "PlayerDisconnected", "playerdisconnected", fPlayerDisconnect ) // Add PlayerDisconnected hook that calls our function.

RunConsoleCommand("sv_alltalk", "0")
RunConsoleCommand("sbox_godmode", "1")
RunConsoleCommand("sbox_noclip", "1")
RunConsoleCommand("sbox_plpldamage", "0")